﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace WellDone
{
    public sealed partial class EditSettingDialog : Page
    {
        public event EventHandler CloseRequested;
        public bool bCanceled = false;
        public string strValue = "";
        public EditSettingDialog()
        {
            this.InitializeComponent();
        }
        public void init(string strSetting, string strValue)
        {
            // Display the setting name and value
            tblkSetting.Text = strSetting;
            //tbValue.
            tbValue.Text = (strValue == null) ? "" : strValue;
        }
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            // Set the "Canceled" flag
            bCanceled = true;
            // Close the dialog
            if (this.CloseRequested != null)
            {
                this.CloseRequested(this, EventArgs.Empty);
            }
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            // Set the new value
            strValue = tbValue.Text;            
            // Close the dialog
            if (this.CloseRequested != null)
            {
                this.CloseRequested(this, EventArgs.Empty);
            }
        }
    }
}
